package com.nfdw.project.service.impl;

import com.nfdw.project.core.AbstractService;
import com.nfdw.project.dao.RetailUserTradeSettleInfoMapper;
import com.nfdw.project.dto.RetailUserTradeSettleInfoDto;
import com.nfdw.project.model.RetailUserTradeSettleInfo;
import com.nfdw.project.service.RetailUserTradeSettleInfoService;
import com.nfdw.project.vo.RetailUserTradeSettleInfoVo;
import com.nfdw.project.vo.RetailUserTradeSettleTotalInfoVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Optional;

@Service
@Transactional
public class RetailUserTradeSettleInfoServiceImpl extends AbstractService<RetailUserTradeSettleInfo> implements RetailUserTradeSettleInfoService {

    @Resource
    private RetailUserTradeSettleInfoMapper retailUserTradeSettleInfoMapper;

    @Override
    public RetailUserTradeSettleTotalInfoVo tradeSettleInfo(RetailUserTradeSettleInfoDto param) {
        RetailUserTradeSettleTotalInfoVo retailUserTradeSettleTotalInfoVo = retailUserTradeSettleInfoMapper.tradeSettleInfo(param);
        Optional<RetailUserTradeSettleTotalInfoVo> entity = Optional.ofNullable(retailUserTradeSettleTotalInfoVo);
        return entity.orElse(new RetailUserTradeSettleTotalInfoVo());
    }

    @Override
    public List<RetailUserTradeSettleInfoVo> tradeSettleAnalysis(RetailUserTradeSettleInfoDto param) {
        return retailUserTradeSettleInfoMapper.tradeSettleAnalysis(param);
    }

}
